<?php

/**
 * 文章管理控制器
 * Class ArcController
 */
class ArcController{
    /**
     * 留言异步添加
     */
    public function add(){
        $data = include './data.php';
        $data[] = $_POST;
        file_put_contents('./data.php',"<?php return " . var_export($data,true) . "?>");

        //获得所有的键名,然后取得最大值
        $id = max(array_keys($data));
        //把$_POST转为json对象返回给异步js
        $_POST['id'] = $id;
        echo json_encode($_POST);
    }
}






